<?php

namespace App\WechatHandlers;

use App\Models\NormalReply;
use App\Services\WechatCustomService;

class MessageHandler
{
    protected function normalMsgReply($msgType, $toUserId)
    {
        $reply = NormalReply::query()->with(['material'])->where('msg_type', $msgType)
            ->first();
        if (!$reply) {
            $reply = NormalReply::query()->with(['material'])->whereNull('msg_type')
                ->first();
        }
        if ($reply) {
            WechatCustomService::send($reply, $toUserId);
        }
    }
}